package ecstore.customWidgets;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;

public class ItemSlot extends Composite{
	DecoratorPanel decoratorPanel = new DecoratorPanel();
	VerticalPanel verticalPanel = new VerticalPanel();
	
	Image image = new Image();
	Label itemName = new Label("Pall Mall Amber 25");
	Label itemPriceTag = new Label("Price: $");
	
	/**
	 * @wbp.parser.constructor
	 */
	public ItemSlot() {
		
		decoratorPanel.setSize("100px", "200px");
		
		decoratorPanel.setWidget(verticalPanel);
		verticalPanel.setSize("100px", "200px");
		
		image.setUrl("http://www.tobacco.net.au/images/T/PALL_MALL_AMBER_25_TH.jpg");
		verticalPanel.add(image);
		
		itemName.setStyleName("gwt-LabelDescription");
		verticalPanel.add(itemName);
		
		itemPriceTag.setText("Price: $");		
		itemPriceTag.setStyleName("gwt-LabelDescription");
		verticalPanel.add(itemPriceTag);
		initWidget(decoratorPanel);
	}
	
	/*
	public ItemSlot(String imageURL, String name, String price){
		
		decoratorPanel.setSize("180px", "258px");
		
		decoratorPanel.setWidget(verticalPanel);
		verticalPanel.setSize("165px", "243px");
		
		image.setUrl(imageURL);
		verticalPanel.add(image);
		
		itemName.setStyleName("gwt-LabelDescription");
		verticalPanel.add(itemName);
		
		itemPriceTag.setText("Price: $");		
		itemPriceTag.setStyleName("gwt-LabelDescription");
		verticalPanel.add(itemPriceTag);
	
		initWidget(decoratorPanel);
		
	}
	*/
	public void setSize(String x, String y){
		
	}
	
	public void setImage(String imageURL){
		image.setUrl(imageURL);
	}

	public void setName(String newName){
		itemName.setText(newName);
	}
	
	public void setPrice(double newPrice){
		itemPriceTag.setText("Price: $" + String.valueOf(newPrice));
	}
}
